package reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class ReflectDemo6 {
    public static void main(String[] args) throws Exception {
        Class cls = Person.class;
        Method method = cls.getMethod("say", String.class);

        int modifiers = method.getModifiers();
        switch (modifiers) {
            case Modifier.PUBLIC:
                System.out.println("public");
                break;
            case Modifier.PRIVATE:
                System.out.println("private");
                break;
            case Modifier.PROTECTED:
                System.out.println("protected");
                break;
            case Modifier.STATIC:
                System.out.println("static");
                break;
            case Modifier.FINAL:
                System.out.println("final");
                break;
        }

    }
}
